package de.hwr.it11.dectree;

import net.miginfocom.swt.MigLayout;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.SWTResourceManager;

import de.hwr.it11.dectree.controller.Controller;
import de.hwr.it11.dectree.gui.MainView;
import de.hwr.it11.dectree.language.Messages;
import de.hwr.it11.dectree.model.Project;

/**
 * Der <code>Starter</code> ist der Einstiegspunkt der Applikation..
 */
public class Starter {

	public static void main(String[] args) {
		Project project = new Project();
		Controller controller = new Controller(project);

		Display display = Display.getDefault();
		Shell shell = new Shell(display);
		shell.setText(Messages.APPLICATION_TITLE);
		shell.setImage(SWTResourceManager.getImage(Starter.class, "/img/dectree.jpg"));
		shell.setLayout(new MigLayout("fill, ins 0"));

		MainView view = new MainView(shell, SWT.NONE, controller, project);
		view.setLayoutData("hmin 0, wmin 0, grow");

		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		SWTResourceManager.dispose();
	}

}
